//! px:postgres_config
use pavex::config;
use redact::Secret;

#[config(key = "postgres")]
#[derive(serde::Deserialize, Debug, Clone)]
pub struct PostgresConfig {
    pub pool: PoolConfig,
    pub connection: ConnectionConfig,
}

#[derive(serde::Deserialize, Debug, Clone)]
pub struct ConnectionConfig {
    pub username: String,
    pub password: Secret<String>,
    pub host: String,
    pub database_name: String,
    pub require_ssl: bool,
}

#[derive(serde::Deserialize, Debug, Clone)]
pub struct PoolConfig {
    pub min_size: u32,
    pub max_size: u32,
}
